package com.polytech.diploma.OracleStatStep;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.pentaho.di.core.Const;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStepMeta;
import org.pentaho.di.trans.step.StepDialogInterface;
import org.pentaho.di.ui.trans.step.BaseStepDialog;

public class OracleStatStepDialog extends BaseStepDialog implements
		StepDialogInterface, VerifyListener, ModifyListener {
	
	private OracleStatStepMeta input;

	private Label        wlSchemaName = null;
	private Text         wSchemaName = null;
	private FormData     fdlSchemaName = null, fdSchemaName = null;
	
	private Label        wlDistribution = null;
	private FormData     fdlDistribution = null;
	
	private Button       wlMemoryStat = null;
	private Text         wMemoryStat = null;
	private FormData     fdlMemoryStat = null, fdMemoryStat = null;

	private Button       wlIOStat = null;
	private Text         wIOStat = null;
	private FormData     fdlIOStat = null, fdIOStat = null;

	private Button       wlCostStat = null;
	private Text         wCostStat = null;
	private FormData     fdlCostStat = null, fdCostStat = null;

	private Button       wlDurationStat = null;
	private Text         wDurationStat = null;
	private FormData     fdlDurationStat = null, fdDurationStat = null;

	private Button       wlRowsStat = null;
	private Text         wRowsStat = null;
	private FormData     fdlRowsStat = null, fdRowsStat = null;

	private Label        wlMPSize = null;
	private FormData     fdlMPSize = null;
	
	private Button       wlMPSizeInPerc = null;
	private Text         wMPSizeInPerc = null;
	private FormData     fdlMPSizeInPerc = null, fdMPSizeInPerc = null;

	private Button       wlMPSizeInRows = null;
	private Text         wMPSizeInRows = null;
	private FormData     fdlMPSizeInRows = null, fdMPSizeInRows = null;

	/*private Button       wlMPSizeOnDisk = null;
	private Text         wMPSizeOnDisk = null;
	private FormData     fdlMPSizeOnDisk = null, fdMPSizeOnDisk = null;*/

	private boolean memorySelected = false;
	private boolean ioSelected = false;
	private boolean costSelected = false;
	private boolean durationSelected = false;
	private boolean rowsSelected = false;
	
	private boolean sizeInPercSelected = true;
	private boolean sizeInRowsSelected = false;
	//private boolean sizeOnDiskSelected = false;
	
	public OracleStatStepDialog(Shell parent, Object in,
			TransMeta transMeta, String stepname) 
	{
		super(parent, (BaseStepMeta) in, transMeta, stepname);
		
		input=(OracleStatStepMeta)in;
	}

	public OracleStatStepDialog(Shell parent, int nr, BaseStepMeta in, TransMeta tr) 
	{
		super(parent, nr, in, tr);
	}

	public String open() 
	{
		Shell parent = getParent();
		Display display = parent.getDisplay();
		
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
		props.setLook(shell);
		props.setDialogSize(shell, "JobFileExistsDialogSize");
		//setShellImage(shell, input);
		
		FormLayout formLayout = new FormLayout();
		formLayout.marginWidth  = Const.FORM_MARGIN;
		formLayout.marginHeight = Const.FORM_MARGIN;

		shell.setLayout(formLayout);
		shell.setText(Messages.getString("OracleStatStepDialog.Shell.Title"));
		
		//int middle = props.getMiddlePct();
		int margin = Const.MARGIN;
		
		input.setChanged();
		
		wlStepname=new Label(shell, SWT.RIGHT);
		wlStepname.setText(Messages.getString("OracleStatStepDialog.StepName.Label"));
        props.setLook( wlStepname );
        fdlStepname=new FormData();
        fdlStepname.left = new FormAttachment(5, 0);
        fdlStepname.right= new FormAttachment(25, 0);
        fdlStepname.top  = new FormAttachment(0, margin);
		wlStepname.setLayoutData(fdlStepname);
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wStepname );
        fdStepname=new FormData();
        fdStepname.left = new FormAttachment(wlStepname, margin);
        fdStepname.right= new FormAttachment(50, -margin);
        fdStepname.top  = new FormAttachment(0, margin);
        wStepname.setLayoutData(fdStepname);
		
        wlSchemaName=new Label(shell, SWT.RIGHT);
        wlSchemaName.setText(Messages.getString("OracleStatStepDialog.SchemaName.Label"));
        props.setLook( wlSchemaName );
        fdlSchemaName=new FormData();
        fdlSchemaName.left = new FormAttachment(5, 0);
        fdlSchemaName.right= new FormAttachment(25, 0);
        fdlSchemaName.top  = new FormAttachment(wStepname, margin);
        wlSchemaName.setLayoutData(fdlSchemaName);
        wSchemaName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wSchemaName );
        fdSchemaName=new FormData();
        fdSchemaName.left = new FormAttachment(wlSchemaName, margin);
        fdSchemaName.right= new FormAttachment(50, -margin);
        fdSchemaName.top  = new FormAttachment(wStepname, margin);
        wSchemaName.setLayoutData(fdSchemaName);

        wlDistribution=new Label(shell, SWT.LEFT);
        wlDistribution.setText(Messages.getString("OracleStatStepDialog.Distribution.Label"));
        props.setLook( wlDistribution );
        fdlDistribution=new FormData();
        fdlDistribution.left = new FormAttachment(5, 0);
        fdlDistribution.right= new FormAttachment(50, -margin);
        fdlDistribution.top  = new FormAttachment(wSchemaName, margin*2);
        wlDistribution.setLayoutData(fdlDistribution);
        
        wMemoryStat = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wMemoryStat );
        fdMemoryStat=new FormData();
        fdMemoryStat.left = new FormAttachment(5, 0);
        fdMemoryStat.right= new FormAttachment(25, 0);
        fdMemoryStat.top  = new FormAttachment(wlDistribution, margin);
        wMemoryStat.setLayoutData(fdMemoryStat);
        wlMemoryStat=new Button(shell, SWT.CHECK | SWT.LEFT);
        wlMemoryStat.setText(Messages.getString("OracleStatStepDialog.MemoryStat.Label"));
        props.setLook( wlMemoryStat );
        fdlMemoryStat=new FormData();
        fdlMemoryStat.left = new FormAttachment(wMemoryStat, margin);
        fdlMemoryStat.right= new FormAttachment(50, -margin);
        fdlMemoryStat.top  = new FormAttachment(wlDistribution, margin);
        wlMemoryStat.setLayoutData(fdlMemoryStat);
        
        wIOStat = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wIOStat );
        fdIOStat=new FormData();
        fdIOStat.left = new FormAttachment(5, 0);
        fdIOStat.right= new FormAttachment(25, 0);
        fdIOStat.top  = new FormAttachment(wMemoryStat, margin);
        wIOStat.setLayoutData(fdIOStat);
        wlIOStat=new Button(shell, SWT.CHECK | SWT.LEFT);
        wlIOStat.setText(Messages.getString("OracleStatStepDialog.IOStat.Label"));
        props.setLook( wlIOStat );
        fdlIOStat=new FormData();
        fdlIOStat.left = new FormAttachment(wIOStat, margin);
        fdlIOStat.right= new FormAttachment(50, -margin);
        fdlIOStat.top  = new FormAttachment(wMemoryStat, margin);
        wlIOStat.setLayoutData(fdlIOStat);
        
        wCostStat = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wCostStat );
        fdCostStat=new FormData();
        fdCostStat.left = new FormAttachment(5, 0);
        fdCostStat.right= new FormAttachment(25, 0);
        fdCostStat.top  = new FormAttachment(wIOStat, margin);
        wCostStat.setLayoutData(fdCostStat);
        wlCostStat=new Button(shell, SWT.CHECK | SWT.LEFT);
        wlCostStat.setText(Messages.getString("OracleStatStepDialog.CostStat.Label"));
        props.setLook( wlCostStat );
        fdlCostStat=new FormData();
        fdlCostStat.left = new FormAttachment(wCostStat, margin);
        fdlCostStat.right= new FormAttachment(50, -margin);
        fdlCostStat.top  = new FormAttachment(wIOStat, margin);
        wlCostStat.setLayoutData(fdlCostStat);
        
        wDurationStat = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wDurationStat );
        fdDurationStat=new FormData();
        fdDurationStat.left = new FormAttachment(5, 0);
        fdDurationStat.right= new FormAttachment(25, 0);
        fdDurationStat.top  = new FormAttachment(wCostStat, margin);
        wDurationStat.setLayoutData(fdDurationStat);
        wlDurationStat=new Button(shell, SWT.CHECK | SWT.LEFT);
        wlDurationStat.setText(Messages.getString("OracleStatStepDialog.DurationStat.Label"));
        props.setLook( wlDurationStat );
        fdlDurationStat=new FormData();
        fdlDurationStat.left = new FormAttachment(wDurationStat, margin);
        fdlDurationStat.right= new FormAttachment(50, -margin);
        fdlDurationStat.top  = new FormAttachment(wCostStat, margin);
        wlDurationStat.setLayoutData(fdlDurationStat);
        
        wRowsStat = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wRowsStat );
        fdRowsStat=new FormData();
        fdRowsStat.left = new FormAttachment(5, 0);
        fdRowsStat.right= new FormAttachment(25, 0);
        fdRowsStat.top  = new FormAttachment(wDurationStat, margin);
        wRowsStat.setLayoutData(fdRowsStat);
        wlRowsStat=new Button(shell, SWT.CHECK | SWT.LEFT);
        wlRowsStat.setText(Messages.getString("OracleStatStepDialog.RowsStat.Label"));
        props.setLook( wlRowsStat );
        fdlRowsStat=new FormData();
        fdlRowsStat.left = new FormAttachment(wRowsStat, margin);
        fdlRowsStat.right= new FormAttachment(50, -margin);
        fdlRowsStat.top  = new FormAttachment(wDurationStat, margin);
        wlRowsStat.setLayoutData(fdlRowsStat);
        
        wlMPSize=new Label(shell, SWT.LEFT);
        wlMPSize.setText(Messages.getString("OracleStatStepDialog.MPSize.Label"));
        props.setLook( wlMPSize );
        fdlMPSize=new FormData();
        fdlMPSize.left = new FormAttachment(60, 0);
        fdlMPSize.right= new FormAttachment(95, -margin);
        fdlMPSize.top  = new FormAttachment(wSchemaName, margin*2);
        wlMPSize.setLayoutData(fdlMPSize);
        
        wMPSizeInPerc = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wMPSizeInPerc );
        fdMPSizeInPerc=new FormData();
        fdMPSizeInPerc.left = new FormAttachment(60, 0);
        fdMPSizeInPerc.right= new FormAttachment(75, 0);
        fdMPSizeInPerc.top  = new FormAttachment(wlMPSize, margin);
        wMPSizeInPerc.setLayoutData(fdMPSizeInPerc);
        wlMPSizeInPerc=new Button(shell, SWT.RADIO | SWT.LEFT);
        wlMPSizeInPerc.setText(Messages.getString("OracleStatStepDialog.MPSizeInPerc.Label"));
        props.setLook( wlMPSizeInPerc );
        fdlMPSizeInPerc=new FormData();
        fdlMPSizeInPerc.left = new FormAttachment(wMPSizeInPerc, margin);
        fdlMPSizeInPerc.right= new FormAttachment(95, -margin);
        fdlMPSizeInPerc.top  = new FormAttachment(wlMPSize, margin);
        wlMPSizeInPerc.setLayoutData(fdlMPSizeInPerc);
        wlMPSizeInPerc.setSelection(true);
        
        wMPSizeInRows = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wMPSizeInRows );
        fdMPSizeInRows=new FormData();
        fdMPSizeInRows.left = new FormAttachment(60, 0);
        fdMPSizeInRows.right= new FormAttachment(75, 0);
        fdMPSizeInRows.top  = new FormAttachment(wMPSizeInPerc, margin);
        wMPSizeInRows.setLayoutData(fdMPSizeInRows);
        wlMPSizeInRows=new Button(shell, SWT.RADIO | SWT.LEFT);
        wlMPSizeInRows.setText(Messages.getString("OracleStatStepDialog.MPSizeInRows.Label"));
        props.setLook( wlMPSizeInRows );
        fdlMPSizeInRows=new FormData();
        fdlMPSizeInRows.left = new FormAttachment(wMPSizeInRows, margin);
        fdlMPSizeInRows.right= new FormAttachment(95, -margin);
        fdlMPSizeInRows.top  = new FormAttachment(wMPSizeInPerc, margin);
        wlMPSizeInRows.setLayoutData(fdlMPSizeInRows);
        
        /*wMPSizeOnDisk = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
        props.setLook( wMPSizeOnDisk );
        fdMPSizeOnDisk=new FormData();
        fdMPSizeOnDisk.left = new FormAttachment(60, 0);
        fdMPSizeOnDisk.right= new FormAttachment(75, 0);
        fdMPSizeOnDisk.top  = new FormAttachment(wMPSizeInRows, margin);
        wMPSizeOnDisk.setLayoutData(fdMPSizeOnDisk);
        wlMPSizeOnDisk=new Button(shell, SWT.RADIO | SWT.LEFT);
        wlMPSizeOnDisk.setText(Messages.getString("OracleStatStepDialog.MPSizeOnDisk.Label"));
        props.setLook( wlMPSizeOnDisk );
        fdlMPSizeOnDisk=new FormData();
        fdlMPSizeOnDisk.left = new FormAttachment(wMPSizeOnDisk, margin);
        fdlMPSizeOnDisk.right= new FormAttachment(95, -margin);
        fdlMPSizeOnDisk.top  = new FormAttachment(wMPSizeInRows, margin);
        wlMPSizeOnDisk.setLayoutData(fdlMPSizeOnDisk);*/
        
		// Some buttons
		wOK=new Button(shell, SWT.PUSH);
		wOK.setText(Messages.getString("System.Button.OK"));
		wCancel=new Button(shell, SWT.PUSH);
		wCancel.setText(Messages.getString("System.Button.Cancel"));

        BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wRowsStat);
        
		// Add listeners
		lsCancel   = new Listener() { public void handleEvent(Event e) { cancel(); } };
		lsOK       = new Listener() { public void handleEvent(Event e) { ok();     } };
		
		wCancel.addListener(SWT.Selection, lsCancel);
		wOK.addListener    (SWT.Selection, lsOK    );
		
		lsDef=new SelectionAdapter() 
			{ 
				public void widgetDefaultSelected(SelectionEvent e) 
				{ 
					ok(); 
				} 
			};
			
		wStepname.addSelectionListener( lsDef );
		
		wlMemoryStat.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        memorySelected = ((Button)(theEvent.widget)).getSelection();
                        if (memorySelected) CheckFields(wMemoryStat);
                    }
                });
		
		wlIOStat.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        ioSelected = ((Button)(theEvent.widget)).getSelection();
                        if (ioSelected) CheckFields(wIOStat);
                    }
                });
		
		wlCostStat.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        costSelected = ((Button)(theEvent.widget)).getSelection();
                        if (costSelected) CheckFields(wCostStat);
                    }
                });
		
		wlDurationStat.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        durationSelected = ((Button)(theEvent.widget)).getSelection();
                        if (durationSelected) CheckFields(wDurationStat);
                    }
                });
		
		wlRowsStat.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        rowsSelected = ((Button)(theEvent.widget)).getSelection();
                        if (rowsSelected) CheckFields(wRowsStat);
                    }
                });
		
		wlMPSizeInPerc.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        sizeInPercSelected = ((Button)(theEvent.widget)).getSelection();
                    }
                });
		
		wlMPSizeInRows.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        sizeInRowsSelected = ((Button)(theEvent.widget)).getSelection();
                    }
                });
		
		/*wlMPSizeOnDisk.addSelectionListener(
                new SelectionAdapter()
                {
                    public void widgetSelected(SelectionEvent theEvent)
                    {
                        sizeOnDiskSelected = ((Button)(theEvent.widget)).getSelection();
                    }
                });*/
		
		// Detect X or ALT-F4 or something that kills this window...
		shell.addShellListener(	new ShellAdapter() 
			{ 
				public void shellClosed(ShellEvent e) 
					{ 
					cancel(); 
					} 
				} 
			);

		// Set the shell size, based upon previous time...
		setSize();
		
		getData();
		input.setChanged(changed);
	
		wMemoryStat.addVerifyListener(this);
		wIOStat.addVerifyListener(this);
		wCostStat.addVerifyListener(this);
		wDurationStat.addVerifyListener(this);
		wRowsStat.addVerifyListener(this);
		wMPSizeInPerc.addVerifyListener(this);
		wMPSizeInRows.addVerifyListener(this);
		//wMPSizeOnDisk.addVerifyListener(this);
		
		wMemoryStat.addModifyListener(this);
		wIOStat.addModifyListener(this);
		wCostStat.addModifyListener(this);
		wDurationStat.addModifyListener(this);
		wRowsStat.addModifyListener(this);
		
		shell.open();
		while (!shell.isDisposed())
		{
		    if (!display.readAndDispatch()) display.sleep();
		}
		return stepname;
	}
	
	// Read data from input
	public void getData()
	{
		wStepname.setText("OracleStatStep");
		wSchemaName.setText(new String(input.getSchemaName()));
		wMemoryStat.setText(new String(input.getMemoryPercent()));
		wIOStat.setText(new String(input.getIoPercent()));
		wCostStat.setText(new String(input.getCostPercent()));
		wDurationStat.setText(new String(input.getDurationPercent()));
		wRowsStat.setText(new String(input.getRowsPercent()));
		wMPSizeInPerc.setText(new String(input.getTotalPercentage()));
		wMPSizeInRows.setText(new String(input.getTotalNumber()));
		//wMPSizeOnDisk.setText(new String(input.getTotalDiskSpace()));
	}
	
	private void cancel()
	{
		stepname=null;
		dispose();
	}
	
	private void ok()
	{
		stepname = wStepname.getText(); // return value
		input.setSchemaName(wSchemaName.getText());
		input.setMemoryPercent(wMemoryStat.getText());
		input.setIoPercent(wIOStat.getText());
		input.setCostPercent(wCostStat.getText());
		input.setDurationPercent(wDurationStat.getText());
		input.setRowsPercent(wRowsStat.getText());
		
		if (sizeInPercSelected) 
			input.setTotalPercentage(wMPSizeInPerc.getText());
		else
			input.setTotalPercentage("0");

		if (sizeInRowsSelected) 
			input.setTotalNumber(wMPSizeInRows.getText());
		else
			input.setTotalNumber("0");

		/*if (sizeOnDiskSelected) 
			input.setTotalDiskSpace(wMPSizeOnDisk.getText());
		else
			input.setTotalDiskSpace("0");*/

		input.setChanged();
        
		dispose();
	}	
	
	public void verifyText(VerifyEvent event) 
	{
		String str = event.text;
        char[] chars = new char[str.length()];
        str.getChars(0, chars.length, chars, 0);
        for (int i = 0; i < chars.length; i++) {
          if (!('0' <= chars[i] && chars[i] <= '9')) {
            event.doit = false;
            return;
          }
        }
	}
	  
	public void modifyText(ModifyEvent event) 
	{
		Text text = (Text) event.widget;
		CheckFields(text);
    }
	
	private void CheckFields(Text text)
	{
		wMemoryStat.removeVerifyListener(this);
		wIOStat.removeVerifyListener(this);
		wCostStat.removeVerifyListener(this);
		wDurationStat.removeVerifyListener(this);
		wRowsStat.removeVerifyListener(this);
		
		wMemoryStat.removeModifyListener(this);
		wIOStat.removeModifyListener(this);
		wCostStat.removeModifyListener(this);
		wDurationStat.removeModifyListener(this);
		wRowsStat.removeModifyListener(this);
		
		try
		{
			int value = 100;
			int memoryStat = 0;
			int ioStat = 0;
			int costStat = 0;
			int durationStat = 0;
			int rowsStat = 0;
		
			if (!wMemoryStat.getText().isEmpty() && memorySelected)
			{
				memoryStat = Integer.parseInt(wMemoryStat.getText());
				value -= memoryStat;
			}
			if (!wIOStat.getText().isEmpty() && ioSelected)
			{
				ioStat = Integer.parseInt(wIOStat.getText());
				value -= ioStat;
			}
			if (!wCostStat.getText().isEmpty() && costSelected)
			{
				costStat = Integer.parseInt(wCostStat.getText());
				value -= costStat;
			}
			if (!wDurationStat.getText().isEmpty() && durationSelected)
			{
				durationStat = Integer.parseInt(wDurationStat.getText());
				value -= durationStat;
			}
			if (!wRowsStat.getText().isEmpty() && rowsSelected)
			{
				rowsStat = Integer.parseInt(wRowsStat.getText());
				value -= rowsStat;
			}
			
			value += Integer.parseInt(text.getText());
			
			if (text == wMemoryStat && memoryStat>=value)
			{
				wMemoryStat.setText(String.valueOf(value));
			}
			else if (text == wIOStat && ioStat>=value)
			{
				wIOStat.setText(String.valueOf(value));
			}
			else if (text == wCostStat && costStat>=value)
			{
				wCostStat.setText(String.valueOf(value));
			}
			else if (text == wDurationStat && durationStat>=value)
			{
				wDurationStat.setText(String.valueOf(value));
			}
			else if (text == wRowsStat && rowsStat>=value)
			{
				wRowsStat.setText(String.valueOf(value));
			}
		}
		catch (NumberFormatException e)
		{
			e.printStackTrace();
		}
		
		wMemoryStat.addVerifyListener(this);
		wIOStat.addVerifyListener(this);
		wCostStat.addVerifyListener(this);
		wDurationStat.addVerifyListener(this);
		wRowsStat.addVerifyListener(this);
		
		wMemoryStat.addModifyListener(this);
		wIOStat.addModifyListener(this);
		wCostStat.addModifyListener(this);
		wDurationStat.addModifyListener(this);
		wRowsStat.addModifyListener(this);
	}
}
